#include "MLComponents.h"


static const int R = 3;


void Render(GameState& state, GameStats& stats, iArr& iD, fArr& fD, tArr& tD)
{
    switch (state)
    {
        case (GameState::MAIN_MENU):
            drawMainMenu(iD, tD);
            break;

        case (GameState::ONE_PLAYER):
            drawSPlayer(iD, tD);
            drawGameStats(stats, iD, fD);
            break;

        case (GameState::TWO_PLAYER):
            drawMPlayer(iD, tD);
            break;

        case (GameState::OPTION):
            drawOptions(iD, tD);
            break;

        default:
            break;
    }

    SDL_Flip(iD[0]);
}


void Logic(SDL_Event& ev, bool& done, GameState& state, GameStats& stats, Mark (&game_board)[R][R],
           Mark& s_mark, iArr& iD, const sArr& sD, const fArr& fD, SDL_Cursor *p1, SDL_Cursor *p2)
{
    while (SDL_PollEvent(&ev))
    {
        switch (state)
        {
            case (GameState::MAIN_MENU):
                logicMainMenu(ev, state, done);
                break;

            case (GameState::ONE_PLAYER):
                logicSPlayer(ev, state, done, iD, sD, game_board, s_mark, stats, p1, p2);
                updateGameStats(ev, game_board, iD, fD, stats);
                break;

                /*
                case (GameState::TWO_PLAYER):
                    logicMPlayer(ev, curr_game_state, done, image_data, text_data, game_board);
                    break;

                case (GameState::OPTION):
                    logicOptions();
                    break;
                */

                default:
                    break;
            }

            updateCursor(ev, s_mark, state, p1, p2);

            if (ev.type == SDL_QUIT)
                done = true;
        }
}


